package com.cmwa.solution.business.infodisclosure.controller;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.cmwa.solution.base.entity.SearchParam;
import com.cmwa.solution.business.infodisclosure.investReport.service.InvestReportService;
import com.cmwa.solution.business.infodisclosure.regulatoryreport.service.RegulatoryReportService;

@Controller
@RequestMapping("/business/infoDisclosure")
public class InfoDisclosureController {
	
	@Resource
	private RegulatoryReportService regulatoryReportService;
	
	@Resource
	private InvestReportService investReportService;
	
	@RequestMapping("/home")
	public String home() {
		return "business/infoDisclosure/home";
	}
	
	@RequestMapping("/infoDisclosureList")
	public String infoDisclosureList() {
		return "business/infoDisclosure/infoDisclosureList";
	}
	
	@RequestMapping("/getReportChart")
	@ResponseBody
	public List<Map<String,String>> getReportChart(SearchParam param) {
		return regulatoryReportService.getReportChart(param);
	}
	
	@RequestMapping("/countReportData")
	@ResponseBody
	public List<Map<String, String>> countReportData(SearchParam param) {
		List<Map<String, String>> isHaveData = investReportService.countReportSize(param);
		List<Map<String, String>> map = new ArrayList<Map<String,String>>();
		if(null != isHaveData && isHaveData.size() != 0){
			map = investReportService.countReportData(param);
		}
		return map;
	}
	
	@RequestMapping("/investReportDown")
	public String investReportDown(SearchParam sp,ModelMap model) {
		model.addAttribute("sp", sp);
		return "business/infoDisclosure/investReport/investReportDown";
	}
}
